function [ res p] = shuffle( A )
%SHUFFLE The function shuffles the columns of the matrix A
%Author: Noam Lerner, 2007
len = length(A);
perm = randperm(len);
if nargout==2
    p = perm;
end
res = zeros(size(A));
for i=1:len
    res(:,i) = A(:,perm(i));
end

